<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%-- 引入页面头 --%>
<%@ include file="/pageHead.jsp"%>
<form name="form1" id="form1" action="<%-- ${systemctx}/sample/saveSample.web --%>" method="post">
	<div class="pageMain">
		<div class="pageTitle"><%=MessageResourcesUtils.getMessage(request, "systemmanage.bascsetting.title") %><span></span>
		<%=MessageResourcesUtils.getMessage(request, "systemmamage.dutymanage.dutycheck.dutycheckList.title") %><span></span>
		<%=MessageResourcesUtils.getMessage(request, "systemmamage.dutymanage.dutycheck.dutycheckList.list") %></div>
		<div class="pageBody">
			<div class="form-group">
				<ul>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmamage.dutymanage.dutyset.dutyList.dutycode") %></label>
						<span><input type="text" class="input-sm" id="dutycode" name="dutycode" value="" /></span>
					</li>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmamage.dutymanage.dutyset.dutyList.dutyname") %></label>
						<span><input type="text" class="input-sm" id="dutyname" name="dutyname" value="" /></span>
					</li>
				</ul>
			</div>	
		</div>
		<div class="button-group">
			<input type="button" class="btn btn-default" id="butQuery" name="butQuery" value="<%=MessageResourcesUtils.getMessage(request, "common.button.query") %>" />
		</div>
		<table width="100%">
			<tbody>
				<tr>
					<td>
						<table id="datagrid"></table>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</form>
<script type="text/javascript">
	$(document).ready(function() {
		
		//加载分页控件 datagrid
		$('#datagrid').issdatagrid(
		{
			formid : 'form1',
			title : '<%=MessageResourcesUtils.getMessage(request, "systemmamage.dutymanage.dutycheck.dutycheckList.list") %>',
			width : 'auto',
			nowrap : true,
			autoRowHeight : false,
			singleSelect : true,
			striped : true,
			url : '${systemctx}/systemmamage/dutymanage/dutycheck/queryDutyCheckListInfoDataGrid.json',
			sortName: 'modifytime',
			sortOrder: 'desc',
			remoteSort : true,
			idField : 'id',
			pagination : true,
			rownumbers : true,
			showFooter : true,
			queryParams:$('#form1').serializeObject(),
			columns : [ [{
				field : 'id',
				title : '<%=MessageResourcesUtils.getMessage(request, "common.button.operation") %>',
				width : 100,
				align : 'center',
				formatter : operate
			},{
				title : '<%=MessageResourcesUtils.getMessage(request, "systemmamage.dutymanage.dutyset.dutyList.dutycode") %>',
				field : 'dutycode',
				width : 160,
				sortable : true,
				align : 'left',
				formatter: function(value,row,index){
					  return "<a href=\"javascript:void(0);\" onclick=\"view('"+row.id+"')\">"+value+"</a>";
				 }
			}, {
				title : '<%=MessageResourcesUtils.getMessage(request, "systemmamage.dutymanage.dutyset.dutyList.dutyname") %>',
				field : 'dutyname',
				width : 160,
				sortable : true,
				align : 'left'
			}, {
				title : '<%=MessageResourcesUtils.getMessage(request, "common.status.title") %>',
				field : 'checkstatus',
				width : 100,
				sortable : true,
				align : 'center'
			} ] ],
			onLoadSuccess : function(data) {

			}
		});

		$('#butQuery').click(function() {
			$('#datagrid').datagrid('load',$('#form1').serializeObject());
		});
	
		function operate(val, row) {
			return '<a href="javascript:void(0);" class="easyui-linkbutton" onclick="dutyCheck('
				+ val
				+ ')"><%=MessageResourcesUtils.getMessage(request, "common.button.check") %></a>';
		}
	});
	
	function view(id){
		$(this).isswindow({
			noheader : true,
			url : '${systemctx}/systemmamage/dutymanage/dutycheck/toViewDuty.web?id=' + id
		});
	}

	
	function dutyCheck(val) {
		var id = val;
		if (confirm("<%=MessageResourcesUtils.getMessage(request, "common.message.alert1") %>")) {
			//正在执行...
			showSending();
			$.ajax({
				type : 'GET',
				url : '${systemctx}/systemmamage/dutymanage/dutycheck/checkDuty.json?id=' + id,
				dataType : 'json',
				success : function(data) {
					//关闭执行...
					closeSending();
						//显示AJAX请求后的提示信息
						$.fn.ajaxmessage(data);
						$('#datagrid').datagrid('reload',$('#form1').serializeObject());
						$('#datagrid').datagrid('clearSelections');
				}
			});
		}
	}
</script>
<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp"%>